package cn.cmcc.online.smsapi.ui.widget;

import android.content.Context;
import android.graphics.Color;
import android.widget.LinearLayout;
import android.widget.TextView;

import cn.cmcc.online.smsapi.ui.util.DensityUtil;

/**
 * Created by ZhangYifan on 2017/6/19.
 */

public class TextTC extends LinearLayout {
    private DotTextView dotTextView;
    private TextView tvContent;

    public TextTC(Context context) {
        super(context);

        setOrientation(VERTICAL);
        init();
    }

    private void init() {
        dotTextView = new DotTextView(getContext());
        LayoutParams titleLinearLayoutParams = new LayoutParams(-1, -2);
        titleLinearLayoutParams.setMargins(DensityUtil.dp2px(getContext(), 15), DensityUtil.dp2px(getContext(), 15), 0, 0);
        addView(dotTextView, titleLinearLayoutParams);

        tvContent = new TextView(getContext());
        tvContent.setTextColor(Color.parseColor("#333333"));
        tvContent.setTextSize(12);
//        tvContent.setText(content);
        LayoutParams tvContentParams = new LayoutParams(-1, -2);
        tvContentParams.setMargins(DensityUtil.dp2px(getContext(), 34), DensityUtil.dp2px(getContext(), 10), DensityUtil.dp2px(getContext(), 15), 0);
        addView(tvContent, tvContentParams);
    }

    public void setTitle(String title) {
        dotTextView.setTitle(title);
    }

    public void setContent(String content) {
        tvContent.setText(content);
    }
}
